package cn.z2huo.demo.spring.cloud.alibaba.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.web.client.RestTemplate;

/**
 * <p>
 *
 * @author z2huo
 */
@Configuration
public class RestTemplateConfig {

    @Bean(name = "restTemplate")
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

    @Primary
    @Bean("loadBalanceRestTemplate")
    @LoadBalanced
    public RestTemplate getLoadBalancedRestTemplate() {
        return new RestTemplate();
    }

}
